package o;

import androidx.annotation.Nullable;
import com.google.android.exoplayer2.source.TrackGroupArray;
import java.io.IOException;
import o.aih.c;
import o.aim.a;

public final class aib implements aih, c {
    private long ʻ = -9223372036854775807L;
    private long ʼ;
    private final alc ˊ;
    public final aim ˋ;
    private c ˎ;
    public final a ˏ;
    private aih ॱ;
    @Nullable
    private b ॱॱ;
    private boolean ᐝ;

    public interface b {
        void ˋ(a aVar, IOException iOException);
    }

    public /* synthetic */ void ˏ(aiw o_aiw) {
        ˎ((aih) o_aiw);
    }

    public aib(aim o_aim, a aVar, alc o_alc, long j) {
        this.ˏ = aVar;
        this.ˊ = o_alc;
        this.ˋ = o_aim;
        this.ʼ = j;
    }

    public void ˏ(b bVar) {
        this.ॱॱ = bVar;
    }

    public void ˏ(a aVar) {
        long ˏ = ˏ(this.ʼ);
        this.ॱ = this.ˋ.ˊ(aVar, this.ˊ, ˏ);
        if (this.ˎ != null) {
            this.ॱ.ˏ(this, ˏ);
        }
    }

    public void ʻ() {
        if (this.ॱ != null) {
            this.ˋ.ॱ(this.ॱ);
        }
    }

    public void ˏ(c cVar, long j) {
        this.ˎ = cVar;
        if (this.ॱ != null) {
            this.ॱ.ˏ(this, ˏ(this.ʼ));
        }
    }

    public void h_() throws IOException {
        try {
            if (this.ॱ != null) {
                this.ॱ.h_();
            } else {
                this.ˋ.ॱ();
            }
        } catch (IOException e) {
            if (this.ॱॱ == null) {
                throw e;
            } else if (!this.ᐝ) {
                this.ᐝ = true;
                this.ॱॱ.ˋ(this.ˏ, e);
            }
        }
    }

    public TrackGroupArray ˋ() {
        return this.ॱ.ˋ();
    }

    public long ॱ(akz[] o_akzArr, boolean[] zArr, aiu[] o_aiuArr, boolean[] zArr2, long j) {
        if (this.ʻ != -9223372036854775807L && j == this.ʼ) {
            j = this.ʻ;
            this.ʻ = -9223372036854775807L;
        }
        return this.ॱ.ॱ(o_akzArr, zArr, o_aiuArr, zArr2, j);
    }

    public void ˎ(long j, boolean z) {
        this.ॱ.ˎ(j, z);
    }

    public long ˎ() {
        return this.ॱ.ˎ();
    }

    public long ॱ() {
        return this.ॱ.ॱ();
    }

    public long ˎ(long j) {
        return this.ॱ.ˎ(j);
    }

    public long ॱ(long j, abv o_abv) {
        return this.ॱ.ॱ(j, o_abv);
    }

    public long ˏ() {
        return this.ॱ.ˏ();
    }

    public void ॱ(long j) {
        this.ॱ.ॱ(j);
    }

    public boolean ˋ(long j) {
        return this.ॱ != null && this.ॱ.ˋ(j);
    }

    public void ˎ(aih o_aih) {
        this.ˎ.ˏ(this);
    }

    public void ˊ(aih o_aih) {
        this.ˎ.ˊ(this);
    }

    private long ˏ(long j) {
        return this.ʻ != -9223372036854775807L ? this.ʻ : j;
    }
}
